package pe.com.ztaxi.taxis.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@Table
@PrimaryKeyJoinColumn(name = "codigo", referencedColumnName = "codigo")
public class Pasajero extends Persona{
	
	@Column(nullable = true)
	private String cargo;
	
	@Column
	private boolean flagPertenece;
	
	@JoinColumn(name = "codEmpresa", referencedColumnName = "codEmpresa")
	@ManyToOne(optional = false, fetch = FetchType.EAGER)
	private Empresa empresa;	

	@JsonIgnore 
	@OneToMany(mappedBy = "pasajero")
	@LazyCollection(LazyCollectionOption.TRUE)
	private List<OrdenServicio> ordenesDeServicio;

	public String getCargo() {
		return cargo;
	}

	public void setCargo(String cargo) {
		this.cargo = cargo;
	}	

	public boolean isFlagPertenece() {
		return flagPertenece;
	}

	public void setFlagPertenece(boolean flagPertenece) {
		this.flagPertenece = flagPertenece;
	}

	public Empresa getEmpresa() {
		return empresa;
	}

	public void setEmpresa(Empresa empresa) {
		this.empresa = empresa;
	}
	
	public List<OrdenServicio> getOrdenesDeServicio() {
		return ordenesDeServicio;
	}

	public void setOrdenesDeServicio(List<OrdenServicio> ordenesDeServicio) {
		this.ordenesDeServicio = ordenesDeServicio;
	}

}
